---
title: all
group: 'Async'
description: Await many promises
---

The `all` function is similar to the builtin Promise.all or Promise.allSettled
functions. Given a list (or object) of promises, if any errors are thrown, all
errors are gathered and thrown in an AggregateError.

## Using an Array

Passing an array as an argument will return the resolved promise values as an array in the same order.

```ts
import { all } from 'radash'

const [user] = await all([
  api.users.create(...),
  s3.buckets.create(...),
  slack.customerSuccessChannel.sendMessage(...)
])
```

## Using an Object

Passing an object as an argument will return an object with the same keys and the values as the resolved promise values.

```ts
import { all } from 'radash'

const { user } = await all({
  user: api.users.create(...),
  bucket: s3.buckets.create(...),
  message: slack.customerSuccessChannel.sendMessage(...)
})
```
